package net.hn.hnms.biz.training.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Wang Jingrui
 * @date 2022/8/25 23:14
 */
@Data
@NoArgsConstructor
@TableName("achievements_examination")
@ApiModel(value = "考评结果实体类")
public class AssessmentResultEntity  extends BaseModel implements Serializable {


    private static final long serialVersionUID = 1320679921325215996L;

    /**
     * ID
     */
    @ExcelIgnore
    @ApiModelProperty(value = "ID")
    @TableId(type = IdType.ASSIGN_UUID)
    private String examinationId;


    /**
     * 区科
     */
    @ExcelProperty(value = "区科")
    @ApiModelProperty(value = "区科")
    @NotBlank(message = "区科不能为空")
    @Length(max = 32,message = "区科长度不能超过32个字符")
    private String department;

    /**
     * 姓名
     */
    @ExcelProperty(value = "姓名")
    @ApiModelProperty(value = "姓名")
    @NotBlank(message = "姓名不能为空")
    @Length(max = 32,message = "姓名长度不能超过32个字符")
    private String personName;

    /**
     * 身份证号码
     */

    @ExcelProperty(value = "身份证号")
    @ApiModelProperty(value = "身份证号码")
    @NotBlank(message = "身份证号码")
    @Length(max = 18,message = "身份证号码长度不能超过18个字符")
    private String identityCode;

    /**
     * 岗位工种
     */
    @ExcelProperty(value = "岗位工种")
    @ApiModelProperty(value = "岗位工种")
    @NotBlank(message = "岗位工种")
    @Length(max = 100,message = "岗位工种长度不能超过100个字符")
    private String post;

    /**
     * 考评时间
     */
    @ExcelIgnore
    @ApiModelProperty(value = "考评时间")
    @NotNull(message = "考评时间不能为空")
    private Date examinationDate;

    /**
     * 理论成绩
     */
    @ExcelProperty(value = "理论成绩")
    @ApiModelProperty(value = "理论成绩")
    @NotBlank(message = "理论成绩不能为空")
    private Double achievement;

    /**
     * 考评结果
     */
    @ExcelProperty(value = "考试结果")
    @ApiModelProperty(value = "考评结果")
    @NotBlank(message = "考评结果不能为空")
    @Length(max = 8,message = "考评结果长度不能超过8个字符")
    private String examinationResult;

    /**
     * 创建时间
     */
    @ExcelIgnore
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @NotNull(message = "创建时间不能为空")
    private Date createTime = new Date();

    /**
     * 更新人ID
     */
    @ExcelIgnore
    @TableField(value = "update_user_id", fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "更新人ID",hidden=true)
    private String updateUserId;

    /**
     * 创建人ID
     */
    @ExcelIgnore
    @TableField(value = "create_user_id", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人ID",hidden=true)
    private String createUserId;


    @Override
    public boolean equals(final Object obj) {
        if (obj == null) {
            return false;
        }
        final AssessmentResultEntity result = (AssessmentResultEntity) obj;
        if (this == result) {
            return true;
        } else {
            return this.identityCode.equals(result.getIdentityCode());
        }
    }
    @Override
    public int hashCode() {
        int hashno = 7;
        hashno = 13 * hashno + (this.identityCode == null ? 0 : this.identityCode.hashCode());
        return hashno;
    }
}
